package com.hanko.designpattern.factory.simple;

import com.hanko.designpattern.factory.ApplePhone;
import com.hanko.designpattern.factory.HuaWeiPhone;
import com.hanko.designpattern.factory.Phone;

import java.util.*;

/**
 * if(type==hauwei) new  华为手机实现类
 * if(type==apple) new   苹果手机实现类
 */
public class PhoneSimpleFactory {

    /**
     * Default constructor
     */
    public PhoneSimpleFactory() {
    }

    /**
     * 
     */
    public Phone producePhone(String type){
        if(type.equalsIgnoreCase("huawei")){
            return new HuaWeiPhone();
        }else if(type.equalsIgnoreCase("apple")) {
            return new ApplePhone();
        }
        return null;
    }

}